package com.cumt.framework.dubbo;


import com.cumt.framework.domain.BaseEntity;
import com.cumt.framework.exception.DubboProviderException;
import com.cumt.framework.rest.view.Page;

import java.util.List;
import java.util.Map;

/**
 * Dubbo抽象接口
 *
 * @param <Entity>
 */
public interface DubboBaseInterface<Entity extends BaseEntity> {

    /**
     * 分页查询
     *
     * @param page
     * @param map
     * @return
     * @throws DubboProviderException
     */
    public Page findByPage(Page page, Map<String, Object> map) throws DubboProviderException;

    /**
     * 持久化对象的信息
     *
     * @param entity
     * @return
     * @throws DubboProviderException
     */
    public boolean save(Entity entity) throws DubboProviderException;

    /**
     * 更新
     *
     * @param entity
     * @return
     * @throws DubboProviderException
     */
    public boolean update(Entity entity) throws DubboProviderException;

    /**
     * 根据ID 删除指定的对象，可以批量删除
     *
     * @param ids
     * @return
     * @throws DubboProviderException
     */
    public boolean deleteById(List<Integer> ids) throws DubboProviderException;

    /**
     * 根据ID 查找指定的对象
     *
     * @param id
     * @return
     * @throws DubboProviderException
     */
    public Entity findById(int id) throws DubboProviderException;

    /**
     * 得到所有的对象
     *
     * @return
     * @throws DubboProviderException
     */
    public List<Entity> findAll() throws DubboProviderException;

    /**
     * 用于多条件查询
     *
     * @param map
     * @return
     * @throws DubboProviderException
     */
    public List<Entity> findByMap(Map<String, Object> map) throws DubboProviderException;

}
